package cn.sirun.com.fca.personal.center.view.impl;

import android.app.Activity;
import android.support.v7.widget.LinearLayoutManager;
import android.util.Log;

import com.tencent.cloud.iov.common.flow.view.impl.BaseLoadingFlowView;
import com.tencent.cloud.iov.flow.presenter.IPresenter;
import com.tencent.cloud.iov.flow.view.IContentViewContainer;
import com.tencent.cloud.iov.kernel.model.BaseResponse;
import com.tencent.cloud.iov.util.ResourcesUtils;
import com.tencent.cloud.uikit.utils.SystemUiUtils;

import cn.sirun.com.fca.personal.center.R;
import cn.sirun.com.fca.personal.center.adapter.CarManagerRecyclerAdapter;
import cn.sirun.com.fca.personal.center.adapter.MessageManagerRecyclerAdapter;
import cn.sirun.com.fca.personal.center.model.request.MessageRequest;
import cn.sirun.com.fca.personal.center.model.response.MessageResponse;
import cn.sirun.com.fca.personal.center.presenter.IMessagePresenter;
import cn.sirun.com.fca.personal.center.presenter.impl.MessagePresenter;
import cn.sirun.com.fca.personal.center.view.IMessageView;
import cn.sirun.com.fca.personal.center.widget.RecyclerView;

public class MessageManagerFlowView extends BaseLoadingFlowView<IMessagePresenter> implements IMessageView{

    private RecyclerView mMessageRV;

    private MessageManagerRecyclerAdapter mAdapter;

    public MessageManagerFlowView(Activity activity) {
        super(activity);
    }

    public MessageManagerFlowView(Activity activity, IContentViewContainer container) {
        super(activity, container);
    }

    @Override
    protected IMessagePresenter createPresenter() {
        return new MessagePresenter();
    }

    @Override
    public void onCreate() {
        super.onCreate();
        setUpActionBar();
        initView();
    }

    private void setUpActionBar() {
        final Activity activity = getActivity();
        SystemUiUtils.showActionBar(
                activity, ResourcesUtils.getString(R.string.message_manager),
                ResourcesUtils.getDrawable(R.color.white));
    }

    private void initView(){
        setContentView(R.layout.message_manager_activity);
        final Activity activity = getActivity();
        mMessageRV = activity.findViewById(R.id.rv_message_list);
        mMessageRV.setLayoutManager(new LinearLayoutManager(activity));
        mAdapter = new MessageManagerRecyclerAdapter(activity);
        mMessageRV.setAdapter(mAdapter);



        MessageRequest messageRequest = new MessageRequest();

        messageRequest.setCode("123456");

        Log.e("xqm","消息请求");
        getPresenter().getMessageList(messageRequest);


    }

    @Override
    public void messageResult(BaseResponse<MessageResponse> result) {

    }
}
